package com.fz.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fz.core.BaseEntity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

import com.fz.vo.GoodsVo;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

/**
 * <p>
 * 存储订单信息
 * </p>
 *
 * @author hyr
 * @since 2025-06-18
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Orders extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 订单编号（业务唯一）
     */
    private String orderId;

    /**
     * 用户id（外键）
     */
    private Long userId;

    /**
     * 订单总金额（≥0）
     */
    private BigDecimal totalAmount;

    /**
     * 支付方式
     */
    private String payMethod;

    /**
     * 配送方式
     */
    private String deliveryMethod;

    /**
     * 订单状态
     */
    private String orderStatus;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 更新时间
     */
    private LocalDateTime updateTime;

    /**
     * 逻辑删除（1=删除）
     */
    private Integer isDeleted;

    @TableField(exist = false)
    List<GoodsVo> goodsList;

    public Orders(String orderId, Long userId, BigDecimal totalAmount, String payMethod, String deliveryMethod, String orderStatus, LocalDateTime createTime) {
        this.orderId =orderId;
        this.userId = userId;
        this.totalAmount = totalAmount;
        this.payMethod = payMethod;
        this.deliveryMethod = deliveryMethod;
        this.orderStatus = orderStatus;
        this.createTime = createTime;
    }

    public Orders(Long id, String orderId, Long userId, BigDecimal totalAmount, String payMethod, String deliveryMethod, String orderStatus, LocalDateTime createTime, LocalDateTime updateTime, List<GoodsVo> goodsList) {
        super(id);
        this.orderId = orderId;
        this.userId = userId;
        this.totalAmount = totalAmount;
        this.payMethod = payMethod;
        this.deliveryMethod = deliveryMethod;
        this.orderStatus = orderStatus;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.goodsList = goodsList;
    }

    public Orders(Long id, String orderStatus) {
        super(id);
        this.orderStatus = orderStatus;
    }

}
